<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{

    protected $tableName = 'users';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create($this->tableName, function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->comment('姓名');
            $table->string('mobile')->unique()->comment('手机号');
            $table->string('password')->comment('密码');
            $table->string('secret')->nullable();
            $table->smallInteger('role_id')->coment('角色');
            $table->string('scope')->nullable()->comment('角色之外的权限');
            $table->tinyInteger('status')->default(1)->comment('状态');

            $table->timestamps();
            $table->softDeletes();

        });
        DB::statement("ALTER TABLE `$this->tableName` comment '管理员表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->tableName);
    }
}
